const puppeteer = require('puppeteer');
const { entry, executablePath, layout } = require('../config/basic');
const { pageClick } = require('./pageClick');
const { pageType } = require('./pageType');

async function initPage() {
  const browser = await puppeteer.launch(
    {
      executablePath,
      headless: false
    }
  );
  
  const page = await browser.newPage();

  const click = pageClick(page)
  const type = pageType(page)

  await page.setViewport(layout);

  await page.goto(entry);

  return { click, type }
}

module.exports = {
  initPage
}